//
//  Lyrics.m
//  作业
//
//  Created by qianfeng on 15/12/8.
//  Copyright (c) 2015年 qianfeng. All rights reserved.
//

#import "Lyrics.h"

@implementation Lyrics

- (id)initWithTime:(NSString *)time andLyric:(NSString *)lrc
{
    if (self = [super init]) {
        
        self.time = time;
        self.lrc = lrc;
        self.timeInterval = [self transTimeInterval];

    }
    return self;
}

-(NSTimeInterval)transTimeInterval{

    NSTimeInterval m = [self.time substringWithRange:NSMakeRange(1, 2)].doubleValue;
    
    NSTimeInterval interval = [self.time substringWithRange:NSMakeRange(4, 5)].doubleValue;
    
    return m*60+interval;
}

- (NSString *)description
{
    return [NSString stringWithFormat:@"%@ %@",_time,_lrc];
}
-(BOOL)compareByTime:(Lyrics *)lyrics
{
    return [_time compare:lyrics.time] == NSOrderedDescending;
}
@end
